d506267d149275e9a27308c8a383c9be4f53d06b,portal-impl/src/com/liferay/portal/servlet/filters/virtualhost/VirtualHostFilter.java,VirtualHostFilter,doFilter,#ServletRequest#ServletResponse#FilterChain#,69

Before Change


			rd.forward(req, res);
		}
		else {
			chain.doFilter(req, res);
		}
	}

After Change


		}

		if (!isValidRequestURL(requestURL)) {
			chain.doFilter(req, res);

			return;
		}

		String contextPath = PortalUtil.getPathContext();

		String friendlyURL = httpReq.getRequestURI().toLowerCase();

		if ((!contextPath.equals(StringPool.SLASH)) &&
			(friendlyURL.indexOf(contextPath) != -1)) {

			friendlyURL = friendlyURL.substring(
				contextPath.length(), friendlyURL.length());
		}

		friendlyURL = StringUtil.replace(
			friendlyURL, StringPool.DOUBLE_SLASH, StringPool.SLASH);

		if (_log.isDebugEnabled()) {
			_log.debug("Friendly URL " + friendlyURL);
		}

		if (!isValidFriendlyURL(friendlyURL)) {
			chain.doFilter(req, res);

			return;
		}

		LayoutSet layoutSet = (LayoutSet)req.getAttribute(
			WebKeys.VIRTUAL_HOST_LAYOUT_SET);

		if (layoutSet != null) {
			try {
				String mainPath = PortalUtil.PATH_MAIN;

				String redirect = PortalUtil.getLayoutActualURL(
					layoutSet.getGroupId(), layoutSet.isPrivateLayout(),
					mainPath, friendlyURL);

				if (_log.isDebugEnabled()) {
					_log.debug("Redirect to " + redirect);
				}

				RequestDispatcher rd = _ctx.getRequestDispatcher(redirect);

				rd.forward(req, res);

				return;
			}
			catch (NoSuchLayoutException nsle) {
				nsle.printStackTrace();
				if (_log.isWarnEnabled()) {
					_log.warn(nsle.getMessage());
				}
			}
			catch (Exception e) {
				_log.error(e, e);
			}
		}

		chain.doFilter(req, res);
	}

	public void destroy() {